#ifndef SPINBOXDELEGATE_H
#define SPINBOXDELEGATE_H

#ifdef COMMONCTRL_LIB
# define COMMONCTRL_EXPORT Q_DECL_EXPORT
#else
# define COMMONCTRL_EXPORT Q_DECL_IMPORT
#endif

#include <QItemDelegate>



class COMMONCTRL_EXPORT  SpinBoxDelegate : public QItemDelegate
{
	Q_OBJECT

public:
	SpinBoxDelegate(QObject *parent);
	~SpinBoxDelegate();

	void		setEnable(bool);
	void		setColumnsForDoubleBox(QVector<int>& vetColumns);
protected:
	QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;

	void setEditorData(QWidget *editor, const QModelIndex &index) const;

	void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;

	void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;

	bool editorEvent ( QEvent * event, QAbstractItemModel * model, const QStyleOptionViewItem & option, const QModelIndex & index );
private:
	bool					m_bEnable;
	QVector<int>			m_vetDoubleBox;
};

#endif // SPINBOXDELEGATE_H
